package com.qingcheng.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.qingcheng.pojo.business.Ad;
import com.qingcheng.service.business.AdService;
import com.qingcheng.service.goods.CategoryService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;
import java.util.Map;

/**
 * Welcome to the most Amazing IntelliJ IIIDEA.
 * Creat0r: ^_^ fffantianxing ^_^
 * Date: 2019-07-01
 * Time: 21:06
 */
@Controller
public class IndexController {

    @Reference
    private AdService adService;
    @Reference
    private CategoryService categoryService;

    @RequestMapping("index")
    public String index(Model model) {
        //轮播图
        List<Ad> adList = adService.findAdByPosition("web_index_lb");
        model.addAttribute("lbt", adList);
        //导航条
        List<Map> categoryList = categoryService.findCategoryTree();
        model.addAttribute("categoryList",categoryList);
        return "index";
    }
}
